package com.hsylient.customer;

import com.hsylient.utils.ConnectionUtil;
import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import lombok.SneakyThrows;

import static com.hsylient.provider.Provider.QUEUE_NAME;

public class Customer {

    @SneakyThrows
    public static void main(String[] args) {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.basicConsume(QUEUE_NAME, false, (consumerTag, message) -> {
            System.out.println(new String(message.getBody()));
        }, (CancelCallback) null);
    }
}
